// HoldMsg.cpp: implementation of the CHoldMsg class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "HoldMsg.h"
#include "../xml/XmlMarkup.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CHoldMsg::CHoldMsg()
{

}

CHoldMsg::~CHoldMsg()
{

}
/*
<AskPT>
<Source Value=SoftPhone />
<Action  Value=Hold />
<Body>
<Station>[Station]</Station>
<UserData>[UserData]</UserData>
</Body>
</AskPT>
*/
CString CHoldMsg::EnSofPhonetMsg()
{
	CString strBody = "";
	strBody = "\
<AskPT>\
<Source Value=SoftPhone />\
<Action  Value=Hold />\
<Body>\
<Station>[Station]</Station>\
<UserData>[UserData]</UserData>\
</Body>\
</AskPT>";
	strBody.Replace("[Station]",m_strStation);
	strBody.Replace("[Station]",m_strUserData);
	return strBody;

}
/*
<AskPT>\
<Source Value=AstCTI />\
<Response  Value=Hold />\
<Body>\
<Result>[Result]</Result>\
<UserData>[UserData]</UserData>\
</Body>\
</AskPT>";
*/
BOOL CHoldMsg::ParaAskMsg(CString strAskMsg)
{
	CXmlMarkup xml;
	xml.SetDoc(strAskMsg);
	
	xml.FindElem(_T("AskPT"));
	xml.IntoElem();
	
	xml.FindElem(_T("Event"));
	m_strEvt = xml.GetAttrib("Value");
	bool bFind = xml.FindElem(_T("Body"));
	if(bFind)
	{
		xml.FindElem(_T("UserData"));
		m_strUserData = xml.GetElemContent();
		xml.OutOfElem();
	}
	else
	{
		return FALSE;
	}
	xml.OutOfElem();
	return TRUE;   
}




